---
id: "string-decorator"
keywords: ["string", "decorator"]
name: "@string"
summary: "This is the `@string` decorator."
category: "decorators"
---

The `@string` decorator can be applied to [polymorphic variant](../docs/manual/polymorphic-variant.mdx) declarations.

### Example

<CodeTab labels={["ReScript", "JS Output"]}>

```res
@val external setStatus: @string[
  @as("NOT_STARTED") #NotStarted |
  @as("STARTED") #Started |
  @as("DONE") #Done
] => unit = "setStatus"

setStatus(#NotStarted)
```

```js
setStatus("NOT_STARTED");
```

</CodeTab>

### References

- [Constrain Arguments Better](../docs/manual/bind-to-js-function.mdx#constrain-arguments-better)
